package tongkeyon.behavior.iterators;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: keyon <tongkeyon@163.com>
 * @Date: 2020/2/25 14:46
 * @Version 1.0
 */
public class Basket implements Aggregate {
    private int index;
    private List<Fruit> fruitList=new ArrayList<>();

    public Basket(int index, List<Fruit> fruitList) {
        this.index = index;
        this.fruitList = fruitList;
    }

    public Basket() {
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public List<Fruit> getFruitList() {
        return fruitList;
    }

    public void setFruitList(List<Fruit> fruitList) {
        this.fruitList = fruitList;
    }

    public void  add(Fruit fruit){
        this.fruitList.add(fruit);
    }

    @Override
    public Iterator iterate() {
        return new FruitIterator(this);
    }
}
